// Decompiled by DJ v3.5.5.77 Copyright 2003 Atanas Neshkov  Date: 16.03.2004 16:26:08
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name:   Hour.java

package com.tizona.system;


public class Hour
{

    Hour(int i, int j)
    {
        HH = i;
        MM = j;
    }

    Hour(Hour hour)
    {
        HH = hour.HH;
        MM = hour.MM;
    }

    private String DD(int i)
    {
        String s = Integer.toString(i);
        return s.length() >= 2 ? s : "0" + s;
    }

    public String toString()
    {
        return DD(HH) + ":" + DD(MM);
    }

    public static Hour parse(String s)
    {
        if(s.length() != 5 || s.charAt(2) != ':')
            throw new NumberFormatException("String is not in Hour format");
        int i;
        int j;
        try
        {
            i = Integer.parseInt(s.substring(0, 2));
            j = Integer.parseInt(s.substring(3, 5));
        }
        catch(NumberFormatException numberformatexception)
        {
            throw new NumberFormatException("String is not in Hour format");
        }
        return new Hour(i, j);
    }

    public int compareTo(Hour hour)
    {
        if(HH < hour.HH)
            return -1;
        if(HH > hour.HH)
            return 1;
        if(MM < hour.MM)
            return -1;
        return MM <= hour.MM ? 0 : 1;
    }

    public int HH;
    public int MM;
}
